@include('home.common.header')
<div class="layui-container">

    <div class="component layui-show-xs-block layui-hide-sm" style="margin: 0px 7.5px;">
        <form class="layui-form" id="search" method="get" action="{{ route('search') }}">
            <div class="layui-inline input">
                <input type="text" id="s" name="search" class="layui-input" required lay-verify="required"
                       placeholder="输入关键字搜索"/>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon">&#xe615;</i></button>
            </div>
        </form>
    </div>

    <div class="layui-row layui-col-space15 main">
        <div class="map">
            @yield('nav')
            @if(request()->url() != env("APP_URL"))
                <span class="layui-breadcrumb">
                <a href="/">首页</a>
                    @isset($category)
                        <a href="{{ url("/category/$category->id") }}">{{$category->name}}</a>
                    @endisset
                    @isset($tag)
                        <a href="{{ url("/tag/$tag->id") }}">{{$tag->name}}</a>
                    @endisset
                    @isset($articleContent)
                        <a href="#">{{$articleContent->title}}</a>
                    @endisset
                    @isset($search)
                        <a href="javascript:void(0);">{{ $search }} 的搜索结果</a>
                    @endisset
                    {{--<a><cite>正文</cite></a>--}}
            </span>
            @endif
        </div>

        <div class="layui-col-md9 layui-col-lg9">
            @yield('content')
        </div>
        <div class="sidebar layui-col-md3 layui-col-lg3">
            @include('home.common.sidebar')
        </div>
    </div>
</div>


<div class="footer">
    @include('home.common.footer')
</div>

<script type="text/javascript">
    (function () {
        var pres = document.querySelectorAll('pre');
        var lineNumberClassName = 'line-numbers';
        pres.forEach(function (item, index) {
            item.className = item.className == '' ? lineNumberClassName : item.className + ' ' + lineNumberClassName;
        });
    })();


</script>
<script type="text/javascript" src="/static/home/js/clipboard.min.js"></script>
<script type="text/javascript" src="/static/home/js/prism.js"></script>
<script type="text/javascript" src="/static/home/js/jquery.min.js"></script>
<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();

    layui.use(['layer', 'flow'], function () {
        var layer = layui.layer;
        var flow = layui.flow;

        flow.lazyimg();

        //错误提示
        @if(count($errors)>0)
        @foreach($errors->all() as $error)
        layer.msg('{{$error}}', {icon: 5});
        @break
        @endforeach
        @endif

        //一次性正确信息提示
        @if(session('success'))
        layer.msg("{{session('success')}}", {icon: 6});
        @endif

        //一次性错误信息提示
        @if(session('error'))
        layer.msg("{{session('error')}}", {icon: 5});
        @endif
    });


</script>
@yield('js')
</body>
</html>
